import Qt 4.7

Rectangle {
    // Text and icon for the Toolbar item
    property string toolbarItemTitle: ""
    property string toolbarItemIcon: ""

    property url source: ""

    // If backsteppingEnabled is set to true, the ToolbarView must implement
    // backsteppingExits() and backstep() functions, which return true or false
    // depeding on whether backstepping signal should exit or send a backstep()
    // signal
    property bool backsteppingEnabled : false

    // Controls whether the backstepping button in the HeaderView should exit
    // when this view is active. When set to false backstep() signal is emitted when
    // backstepping button is pressed
    property bool backsteppingExits : getBacksteppingExits()

    function makeCurrent() {
        pageLoader.source = source
    }

    function getBacksteppingExits() {
        if (backsteppingEnabled == false) {
            return true
        }

        return pageLoader.item.backsteppingExits()
    }

    function backstep() {
        pageLoader.item.backstep()
    }

    width: parent.width
    height: parent.height

    Loader {
        id: pageLoader
        anchors.fill: parent
    }

    Behavior on opacity { NumberAnimation { duration: 200} }
}
